<%-- 
    Document   : inmueble
    Created on : 17/01/2012, 01:00:21 PM
    Author     : czela
--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>

 <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <script type="text/javascript" src="/Fonafe-Bienes/js/jquery.min.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsindex.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsvalidaciones.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/paginacion/jquery.pagination.js"></script>
    <link href="/Fonafe-Bienes/css/default.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/Fonafe-Bienes/css/paginacion/pagination.css" />
    <!-- Inicio Paginacion-->
    <script type="text/javascript">
        var items_per_page = 15;
        <s:set name="items_per_tabla" value="15" />
            (function($) {

                $(document).ready(function(){
                    initPagination();
                });

                function pageselectCallback(page_index, jq){
                    $('#Searchresult').empty();
                    var num_entries = $('#hiddenresult div.result').length;
                    var max_elem = Math.min((page_index+1) * items_per_page, num_entries);

                    for(var i=page_index*items_per_page;i<max_elem;i++) {
                        var new_content = $('#hiddenresult div.result:eq('+i+')').clone();
                        $('#Searchresult').append(new_content);
                    }
                    return false;
                }

                function initPagination() {
                    var num_entries = $('#hiddenresult div.result').length;
                    $("#Pagination").paginationList(num_entries, {
                        callback: pageselectCallback,
                        items_per_page: items_per_page,
                        num_display_entries: 4,
                        num_edge_entries: 2,
                        prev_text: '<<',
                        next_text: '>>'
                    });
                }

            })(jQuery);
    </script>
    <!-- Fin Paginacion-->
</head>
                
  <body>
    <!--JQuery-->
<div id="header">  
         <jsp:include page="/base/header.jsp" flush="false"/>
         <jsp:include page="/base/menu.jsp" >
					<jsp:param name="parametro" value="inmueble" />
		</jsp:include>
</div>

<div id="main">
   
    
        <div id="cuerpo">
        <!--sub-menu-->
        <s:form name="formInmFinal" action="buscaInmuebles" method="post" theme="simple" > 
           
        <div class="slide_menu align_left">
                  
                  <div class="c_busqueda">
                      <div class="titulo_c_busqueda">Buscador de Inmuebles</div>
                      <div class="cuadro_b_inicial no_border">
                          
                          <div class="bloque">
                              <span>Empresa</span>
                              <s:select label="Empresa" name="id_empresa" headerKey="0" headerValue="--Todos--" list="listEmpresa" listKey="id_empresa" listValue="nombre_empresa" theme="simple"/>                   
                          </div>  
                          
                          <div class="bloque">
                             <span>Depart / Provincia / Distrito</span>
                             <input id="oculto" type="hidden"/>
                             <input autocomplete="off" id="TxtUbigeo" type="text" value="<s:property value="ubigeo"/>" onkeyup="$.autocomplete($(this))" class="texto_mediano" name="ubigeo" size="20px"/>                           </div>
                             
                         
                          <div class="bloque">
                            <span>Tipo de Inmueble</span>
                            <s:select cssClass="etiquetaStruts"  name="tipInmueble" headerKey="0" headerValue="--Todos--"  list="listTipoInmueble" listKey="idTipoInmueble" listValue="nombre" theme="simple"/>
                          </div>
                           
                          <div class="area_boton_envio">
                                <a href="javascript:document.formInmFinal.submit();" class="isbutton">Buscar</a>                               
                          </div>
                          
                      </div>
                      <ul>
                         
                          <li>
                              <a class="top_item_sin_slide" href="javascript:void(0)">Tipo de Contrato</a>
                              
                              <div class="sub_menu_sin_hidden no_border">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                    <s:if test="%{tipContrato == 'Venta'}">
                                      <li>
                                          <input type="radio" name="tipContrato" checked="true" value="Venta" class="align_left" onclick="document.formInmFinal.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" class="align_left" onclick="document.formInmFinal.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{tipContrato == 'Alquiler'}">
                                      <li>
                                          <input type="radio" name="tipContrato" value="Venta" class="align_left" onclick="document.formInmFinal.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" checked="true"  class="align_left" onclick="document.formInmFinal.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{tipContrato != 'Alquiler' && tipContrato != 'Venta'}">
                                      <li>
                                          <input type="radio" name="tipContrato" value="Venta" class="align_left" onclick="document.formInmFinal.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" class="align_left" onclick="document.formInmFinal.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                  </ul>
                                  </div>
                                  
                              </div>
                          </li>
                          <li><a href="javascript:void(0)" class="top_item_sin_slide">Precio</a>
                              <div class="sub_menu_sin_hidden">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                      <li>
                                           
                                           
                                           <s:if test="%{tipMoneda == 'Sol'}">
                                               <input type="radio" name="tipMoneda" checked="true" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                           <s:if test="%{tipMoneda == 'Dolar'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" checked="true"  value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                           <s:if test="%{tipMoneda == 'Euro'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda"  checked="true"  value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                               
                                           <s:if test="%{tipMoneda != 'Sol' && tipMoneda != 'Dolar' && tipMoneda != 'Euro'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                           
                                           
                                      </li>
                                      <li>
                                          <span class="align_left span_block">De</span>
                                          <input type="text" class="align_left texto_precio" id="TxtprecioDesde" name="precioDesde" value="<s:property value="precioDesde"/>" onkeypress="return $.solonumerodecimal(event);"/>
                                          <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <span class="align_left span_block">a</span>
                                          <input type="text" class="align_left texto_precio" id="TxtprecioHasta" name="precioHasta" value="<s:property value="precioHasta"/>" onkeypress="return $.solonumerodecimal(event);"/>
                                          <div class="clean_space"></div>
                                      </li>
                                      
                            
                                  </ul>
                                  </div>
                                  <div class="area_boton_envio" align="right">
                                      <a href="javascript:document.formInmFinal.submit();" ><u> Actualizar </u></a>
                                   </div>

                              </div>
                          </li>
                      </ul>
                  </div>

          </div>
        </s:form>
        
        <!--listado-->
        
        <div class="slide_content align_rigth">
                     <s:if test="%{mensajeOk != null}">
                        <div class="msg-success" style="width: 330px;">
                            <s:property value="mensajeOk"/>
                        </div>
                    </s:if>
                    <s:if test="%{mensajeFail != null}">
                        <div class="msg-error" style="width: 330px;">
                            <s:property value="mensajeFail"/>
                        </div>
                    </s:if>
                    
            
                  <div class="contenido_grilla">
                      <table cellspacing="0" cellpadding="0" class="tabla_grilla">                          
                              <tbody><tr>
                                  <th class="width_item1"><span class="bg1"></span>Nombre</th>
                                  <th class="width_item2">Descripci&oacute;n</th>
                                  <th class="width_item3">Fecha</th>
                                  <th class="width_item4"><span class="bg2"></span>Precio</th>
                              </tr>
                      </tbody></table>
                      <div id="Searchresult">Cargando...</div>
                      <s:if test="%{listInmueble.size() == 0}">
                         <div class="msg-noresult msg-info" style="width: 500px;" align="center">
                          Lo sentimos, no encontramos resultados para tu b&uacute;squeda,<br/>
                          intenta otra b&uacute;squeda, se pueden encontrar muchas cosas.
                          </div>
                      </s:if>
                      <div id="Pagination" style="width:950px "></div>
                      <div id="hiddenresult" style="display:none;">
                      <s:iterator value="listInmueble" var="bean" status="row">
                      <div class="result">
                      <div class="contenido_items_body">
                          <div class="item_resultado">
                              <div class="img_item width_item1">
                                  <s:url action="detalleInmueble" id="detalleInmu">
                                    <s:param name="idInmueble" value="id"></s:param>
                                  </s:url>
                                  <s:a href="%{detalleInmu}">
                                     <s:url action="verImagen" id="verImag"/>
                                     <img alt="<s:property value="nombre"/>" src="Fonafe-Bienes/struts/verImagen?idFoto=<s:property value="id"/>" width="120" height="90" style="max-width: 120px; max-height: 90px;"/>
                                  </s:a>
                              </div>
                              <div class="descripcion_item width_item2">
                                  <span class="etiqueta_1" style="text-decoration: underline"><s:a href="%{detalleInmu}"><s:property value="nombre"/></s:a></span>
                                  <span class="etiqueta_3">
                                      <s:if test="%{descripcion.length() > 100}">
                                        <s:property value="descripcion.substring(0, 100)" escapeCsv="false"/> ...
                                      </s:if>
                                      <s:else>
                                        <s:property value="descripcion" escapeCsv="false"/> 
                                      </s:else>
                                      <br/><br/><span style="text-decoration: underline"><s:a class="ver_mas" href="%{detalleInmu}">Ver m&aacute;s</s:a></span>
                                  </span>
                              </div>
                                      <div class="fecha_item width_item3"><s:property value="fechaInmueble"/></div>
                              <div class="precio_item width_item4">
                                    <s:if test="%{tipoMoneda == 'Sol'}">
                                        <s:set name="tipCoin">S/ </s:set>
                                    </s:if>
                                    <s:elseif test="%{tipoMoneda == 'Dolar'}">
                                        <s:set name="tipCoin">US$ </s:set>
                                    </s:elseif>
                                    <s:elseif test="%{tipoMoneda == 'Euro'}">
                                        <s:set name="tipCoin">EUR </s:set>
                                    </s:elseif>
                                    <s:property value="tipCoin"/>&nbsp;<s:property value="vchPrecio"/>                             
                              </div>
                              <div class="clean_space"></div>
                          </div>
                          <%--s:if test="%{#row.count%#items_per_tabla == 0 || #row.count == #listInmueble.size()}"--%>
                          </div>
                         </div> <!--Fin Result-->
                        <%--/s:if--%>
                      </s:iterator>
                    </div><!--Fin hiddenresult-->
                  </div>
         </div>
        
         <div class="clean_space"></div>
        
       </div>
   
</div>
 <jsp:include page="/base/footer.jsp" flush="false" />     
   </body>
</html>
